home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3512 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.9 KB  |  76 lines

  1. Path: news.vub.ac.be!etro3!kpgoderi
  2. From: kpgoderi@etro3 (Karel Goderis)
  3. Newsgroups: comp.lang.c++
  4. Subject: RW Tools.h++'s persistence - second try
  5. Date: 24 Jan 1996 14:54:50 GMT
  6. Organization: Brussels Free Universities VUB/ULB
  7. Message-ID: <4e5h7q$sip@rc1.vub.ac.be>
  8. Reply-To: kpgoderi@etro.vub.ac.be
  9. NNTP-Posting-Host: etro3.vub.ac.be.
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Ugh... some newsreaders suck - here is the posting
  13.  
  14.  
  15. Watch this small piece of code, and then the warnings I get when 
  16. compiling the code. The persistence machinary do write the stuff in a 
  17. decent way, but reading  messes up.
  18.  
  19. class Coordinate : public RWCollectable {
  20.  
  21.   RWDECLARE_COLLECTABLE(Coordinate)
  22.  
  23. public:
  24.   Coordinate();
  25.  
  26.   int x;
  27.   int y;
  28.  
  29.   //From RwCollectable - for persistence
  30.   virtual void restoreGuts(RWFile& f);
  31.   virtual void restoreGuts(RWvistream& strm);
  32.   virtual void saveGuts(RWFile& f) const;
  33.   virtual void saveGuts(RWvostream& strm) const;
  34.  
  35. };
  36.  
  37.  
  38. here follows the code for the persistence stuff . I omitted a lot of the code
  39.  
  40.  
  41. void Coordinate::restoreGuts(RWvistream& strm)
  42. {
  43.   RWCollectable::restoreGuts(strm);
  44.  
  45.   strm >> x;   // this is line 1144 of the error report
  46.   strm >> y;
  47.  
  48. }
  49.  
  50.  
  51.  
  52. ... and  the error of the compiler
  53.  
  54.  
  55. "ROI.cc", line 1144: Warning (Anachronism): Temporary created for 
  56. argument cstr in call to operator>>(RWvistream&, RWCString&).
  57. "ROI.cc", line 1145: Warning (Anachronism): Temporary created for 
  58. argument cstr in call to operator>>(RWvistream&, RWCString&).
  59.  
  60.  
  61. ... which makes that every read results in a (-1,-1) coordinate, and that 
  62. is not actually the goal of it :) 
  63.  
  64. --
  65.  Karel Goderis
  66.  
  67.  
  68.  VUB - Vrije Universiteit Brussel 
  69.   Personal         --- kpgoderi@etro.vub.ac.be 
  70.  
  71.  IGUANA - Indepent Group of Unix-alikes and Networking activists 
  72.   Personal                --- scollie@medelec.uia.ac.be 
  73.  
  74.  BEST - Board of European Students of Technology 
  75.   General              --- twbest00@vub.ac.be  
  76.